/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * adminMainMenu.java
 *
 * Created on 11 2, 11, 6:29:57 PM
 */
package introsemp;

import javax.swing.*;

/**
 *
 * @author Marit
 */
public class adminMainMenu extends javax.swing.JPanel {

    /** Creates new form adminMainMenu */
    JFrame frame;
    public adminMainMenu() {
        initComponents();
        JLabel bg = new JLabel(new ImageIcon("Images\\adminMainMenu.png"));
        bg.setSize(930, 686);
        add(bg);
        bg.setVisible(true);
    }

    public void remove() {
        frame.remove(this);
    }
    public void setFrame(JFrame frame) {
        this.frame = frame;
        frame.add(this);
        frame.validate();
        frame.setSize(930, 686);
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        gradesMgmt = new javax.swing.JButton();
        classMgmt = new javax.swing.JButton();
        componentsMgmt = new javax.swing.JButton();
        facultyMgmt = new javax.swing.JButton();
        logoutButton = new javax.swing.JButton();

        gradesMgmt.setIcon(new javax.swing.ImageIcon(getClass().getResource("/introsemp/view grades.png"))); // NOI18N
        gradesMgmt.setContentAreaFilled(false);
        gradesMgmt.setFocusPainted(false);
        gradesMgmt.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/introsemp/hover - grades.png"))); // NOI18N
        gradesMgmt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                gradesMgmtActionPerformed(evt);
            }
        });

        classMgmt.setIcon(new javax.swing.ImageIcon(getClass().getResource("/introsemp/sections list button.png"))); // NOI18N
        classMgmt.setContentAreaFilled(false);
        classMgmt.setFocusPainted(false);
        classMgmt.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/introsemp/hover - class list.png"))); // NOI18N
        classMgmt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                classMgmtActionPerformed(evt);
            }
        });

        componentsMgmt.setIcon(new javax.swing.ImageIcon(getClass().getResource("/introsemp/grading system button.png"))); // NOI18N
        componentsMgmt.setContentAreaFilled(false);
        componentsMgmt.setFocusPainted(false);
        componentsMgmt.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/introsemp/hover - grading system button.png"))); // NOI18N
        componentsMgmt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                componentsMgmtActionPerformed(evt);
            }
        });

        facultyMgmt.setIcon(new javax.swing.ImageIcon(getClass().getResource("/introsemp/faculty button.png"))); // NOI18N
        facultyMgmt.setContentAreaFilled(false);
        facultyMgmt.setFocusPainted(false);
        facultyMgmt.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/introsemp/hover - faculty.png"))); // NOI18N
        facultyMgmt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                facultyMgmtActionPerformed(evt);
            }
        });

        logoutButton.setText("Log out");
        logoutButton.setContentAreaFilled(false);
        logoutButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logoutButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(292, 292, 292)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(componentsMgmt, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(gradesMgmt, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(classMgmt, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(facultyMgmt, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(76, 76, 76)
                        .addComponent(logoutButton)))
                .addContainerGap(367, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(classMgmt, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(facultyMgmt, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(47, 47, 47)
                .addComponent(gradesMgmt, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(34, 34, 34)
                .addComponent(componentsMgmt, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 122, Short.MAX_VALUE)
                .addComponent(logoutButton)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

private void gradesMgmtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gradesMgmtActionPerformed

    remove();
    GradeBreakdownUI g = new GradeBreakdownUI(1);
    g.setFrame(frame);
    // TODO add your handling code here:
}//GEN-LAST:event_gradesMgmtActionPerformed

private void classMgmtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_classMgmtActionPerformed
    SectionsUI s = new SectionsUI();
    s.setFrame(frame);
    remove();
    // TODO add your handling code here:
}//GEN-LAST:event_classMgmtActionPerformed

private void componentsMgmtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_componentsMgmtActionPerformed
    remove();
    ComponentsUI com = new ComponentsUI(1);
    com.setFrame(frame);    // TODO add your handling code here:
}//GEN-LAST:event_componentsMgmtActionPerformed

private void facultyMgmtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_facultyMgmtActionPerformed
    FacultyUI f = new FacultyUI();
    f.setFrame(frame);
    remove();// TODO add your handling code here:
}//GEN-LAST:event_facultyMgmtActionPerformed

private void logoutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoutButtonActionPerformed
    JDialog dbox = new JDialog();
    dbox.setSize(400,250);
    int response = JOptionPane.showConfirmDialog(
                    dbox, "Are you sure you want to log out?", " ", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
            if (response == JOptionPane.YES_OPTION ) {
                dbox.dispose();
                System.exit(0);
            } else if (response == JOptionPane.NO_OPTION ) {
                dbox.dispose();
            }// TODO add your handling code here:
}//GEN-LAST:event_logoutButtonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton classMgmt;
    private javax.swing.JButton componentsMgmt;
    private javax.swing.JButton facultyMgmt;
    private javax.swing.JButton gradesMgmt;
    private javax.swing.JButton logoutButton;
    // End of variables declaration//GEN-END:variables
}
